package com.cain.imagefilter;

/**
 * 滤镜工厂
 * 
 * android demo 
 * http://code.google.com/p/android-image-filtering/;
 * java tutorials 
 * http://marvinproject.sourceforge.net/en/tutorials/01_introduction/introduction.html
 * 
 * @author cainli
 *
 */
public class PhotoFilterFactory {
	
	private static PhotoFilterFactory instance = new PhotoFilterFactory();
	public enum PhotoFilterType {
		BLACKWHITEFILTER,BIGBROTHERFILTER,INVERTFILTER,
		MONITORFILTER,NEONFILTER,EDGEFILTER,PIXELATEFILTER
	}
	private PhotoFilterFactory() {
	}
	public static PhotoFilterFactory getInstance(){
		if(instance == null){
			instance = new PhotoFilterFactory();
		}
		return instance;
	}
	
	public PhotoFilter createPhotoFilter(PhotoFilterType type){
		PhotoFilter photoFilter;
		switch (type) {
		case BLACKWHITEFILTER:
			photoFilter = new BlackWhiteFilter();
			break;
		case BIGBROTHERFILTER:
			photoFilter = new BigBrotherFilter();
			break;
		case INVERTFILTER:
			photoFilter = new InvertFilter();
			break;
		case MONITORFILTER:
			photoFilter = new MonitorFilter();
			break;
		case NEONFILTER:
			photoFilter = new NeonFilter();
			break;
		case EDGEFILTER:
			photoFilter = new EdgeFilter();
			break;
		case PIXELATEFILTER:
			photoFilter = new PixelateFilter();
			break;
		default:
			photoFilter = new DefaultFilter();
			break;
		}
		return photoFilter;
	}
}
